All Questions
Tagged with bitwiseinterview-questions
6 questions
13votes
8answers
2kviews
Counting Occurrences of a Specific 3-Bit Pattern in a Byte Array
I was asked this problem in an interview, and this is the solution I came up with. I was told it's not the most efficient solution, but I can't think of any other solution. This is the problem. ...
5votes
1answer
250views
String character changes (case insensitive) - Go
I saw this question on one of the socials, presented as an Apple interview question. I have had to paraphrase as it was not given in text format. (Credit: Instagram @greghogg5) Given a string (S) ...
0votes
2answers
88views
Given an integer number, invert its bits. You cannot use the ~ operator
Here is my code: ...
3votes
4answers
783views
Find the longest length of sequence of 1-bits achievable by flipping a single bit from 0 to 1 in a number
Problem Statement The problem is defined in the book as following: 5.3 You have an integer and you can flip exactly one bit from 0 to ...
5votes
1answer
840views
Check if a given integer is power of two
Given an integer, check if it's the power of two. ...
3votes
3answers
8kviews
Number of right cyclic shifts to give the biggest number
I am preparing to coding interview and I met this task today: You are given 30-bit unsigned integer N. A right cyclic shift of N by K bits is the result of performing a right cyclic shift of N by one ...